package com.teradata.utils;

import com.teradata.entities.Result;
import com.teradata.enums.ResultEnum;

public class ResultUtil {

    public static Result success(Object obj) {
        Result result = new Result();
        result.setCode(ResultEnum.SUCCESS.getCode());
        result.setMsg(ResultEnum.SUCCESS.getMsg());
        result.setData(obj);
        return result;
    }

    public static Result error(ResultEnum resultEnum) {
        return error(resultEnum, resultEnum.getMsg());
    }

    public static Result error(ResultEnum resultEnum, String msg) {
        Result result = new Result();
        result.setCode(resultEnum.getCode());
        result.setMsg(msg);
        return result;
    }


}
